package cn.donting.jme.edit.ui.inspector;

import cn.donting.jme.edit.attribute.Attribute;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import java.util.Collection;

public class AttributeInspectorUI extends InspectorUI {

    private VBox vBox=new VBox();


    public AttributeInspectorUI(String title, ImageView icon) {
        super(null,title, icon);
    }

    /**
     * TODO:
     * @param attribute
     */
    public void addAttribute(Attribute attribute){
        HBox hBox = new HBox();
        hBox.setAlignment(Pos.CENTER_LEFT);
        hBox.getChildren().add(new Label(attribute.getTitle()+":"));
        hBox.getChildren().add(attribute.getUINode());
        VBox.setMargin(hBox,new Insets(2));
        vBox.getChildren().add(hBox);
    }
    public void addAttribute(Collection<Attribute> attributes){
        for (Attribute attribute : attributes) {
            addAttribute(attribute);
        }
    }
    @Override
    public Pane getUiNode() {
        return vBox;
    }
}
